package com.mindskip.xzs.controller.vue;

import cn.hutool.core.map.MapUtil;
import cn.hutool.json.JSONUtil;
import com.mindskip.xzs.base.RestResponse;
import com.mindskip.xzs.base.SystemCode;
import com.mindskip.xzs.model.vo.LoginVo;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;
import java.util.Map;

/**
 * @author : ruoyu
 * @date : 2021/7/13
 */
@RestController
@RequestMapping("/vue")
public class VueTestController {


    @PostMapping("/login")
    public RestResponse<?> login(@Valid @RequestBody LoginVo loginVo) {
        //测试验证
        return RestResponse.ok(true);
//        if (MapUtil.isNotEmpty(map)
//                && map.containsKey("userName") && map.containsKey("password")) {
//            String jsonStr = JSONUtil.toJsonStr(map);
//            System.out.println(jsonStr);
//            return RestResponse.ok(true);
//        } else {
//            return RestResponse.fail(SystemCode.AuthError.getCode(), SystemCode.AuthError.getMessage());
//        }
    }
}
